<?php

// create custom plugin settings menu
add_action('admin_menu', 'trust_create_menu');

function trust_create_menu() {

	//create new top-level menu
	add_menu_page('TRUST Plugin Settings', 'TRUST Settings', 'administrator', __FILE__, 'trust_settings_page');

	//call register settings function
	add_action( 'admin_init', 'register_mysettings' );
}

function mt_admin_scripts() {
	wp_enqueue_script('media-upload');
	wp_enqueue_script('thickbox');
	wp_register_script('my-upload', get_stylesheet_directory_uri().'/js/uploader.js', array('jquery','media-upload','thickbox'));
	wp_enqueue_script('my-upload');
}

function mt_admin_styles() {
	wp_enqueue_style('thickbox');
}

if (isset($_GET['page'])) {
	add_action('admin_print_scripts', 'mt_admin_scripts');
	add_action('admin_print_styles', 'mt_admin_styles');
}

function register_mysettings() {
	//register our settings
    //*___Home Page Text Setting_____*/
	register_setting( 'trust-settings-group', 'hot_line' );
    register_setting( 'trust-settings-group', 'fan_page' );
    register_setting( 'trust-settings-group', 'youtube' );
    register_setting( 'trust-settings-group', 'skype' );
    register_setting( 'trust-settings-group', 'yahoo' );
	register_setting( 'trust-settings-group', 'location' );
	register_setting( 'trust-settings-group', 'address' );
    register_setting( 'trust-settings-group', 'email' );
    register_setting( 'trust-settings-group', 'phonenumber' );
    register_setting( 'trust-settings-group', 'fax' );
    //*___Home Page - Topcontent Catogery Setting_____*/
    register_setting( 'trust-settings-group', 'top_first_category' );
    register_setting( 'trust-settings-group', 'top_second_category' );
    register_setting( 'trust-settings-group', 'top_third_category' );
    register_setting( 'trust-settings-group', 'top_fourth_category' );
    //*___Home Page - Botcontent Catogery Setting_____*/
    register_setting( 'trust-settings-group', 'first_category' );
    register_setting( 'trust-settings-group', 'second_category' );
    //*___News Page - Catogery Setting_____*/
	register_setting( 'trust-settings-group', 'news_godfather_category' );
    register_setting( 'trust-settings-group', 'news_first_category' );
    register_setting( 'trust-settings-group', 'news_second_category' );
    register_setting( 'trust-settings-group', 'news_third_category' );
    register_setting( 'trust-settings-group', 'news_fourth_category' );
	//* Images setting */
	register_setting( 'trust-settings-group', 'logo' );
	register_setting( 'trust-settings-group', 'footerlogo' );
	register_setting( 'trust-settings-group', 'catbanner' );
}

function trust_settings_page() {
?>
<div class="wrap">
<h2>Your Plugin Name</h2>

<form method="post" action="options.php">
    <?php settings_fields( 'trust-settings-group' ); ?>
    <table class="form-table">
        <tr><td colspan="2"><h3>Tùy chỉnh Trang Chủ</h3><td></tr>
        
        <tr valign="top">
        <th scope="row">Logo (Gợi ý: 280 x 102 px)</th>
        <td><input type="text" id="upload_image_logo" name="logo" value="<?php echo get_option('logo'); ?>" /> <input id="upload_image_button_logo" type="button" class="button" value="Upload Image" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Footer Logo (Gợi ý: 113 x 50 px)</th>
        <td><input type="text" id="upload_image_footerlogo" name="footerlogo" value="<?php echo get_option('footerlogo'); ?>" /> <input id="upload_image_button_footerlogo" type="button" class="button" value="Upload Image" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Banner trang Du Học (Gợi ý: 960 x 169 px)</th>
        <td><input type="text" id="upload_image_catbanner" name="catbanner" value="<?php echo get_option('catbanner'); ?>" /> <input id="upload_image_button_catbanner" type="button" class="button" value="Upload Image" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Hot Line</th>
        <td><input type="text" name="hot_line" value="<?php echo get_option('hot_line'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Fan Page</th>
        <td><input type="text" name="fan_page" value="<?php echo get_option('fan_page'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Kênh Youtube</th>
        <td><input type="text" name="youtube" value="<?php echo get_option('youtube'); ?>" /></td>
        </tr>
        
         <tr valign="top">
        <th scope="row">Nick Skype</th>
        <td><input type="text" name="skype" value="<?php echo get_option('skype'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Nick Yahoo</th>
        <td><input type="text" name="yahoo" value="<?php echo get_option('yahoo'); ?>" /></td>
        </tr>
         
        <tr valign="top">
        <th scope="row">Văn Phòng</th>
        <td><input type="text" name="location" value="<?php echo get_option('location'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Địa Chỉ</th>
        <td><input type="text" name="address" value="<?php echo get_option('address'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Email</th>
        <td><input type="text" name="email" value="<?php echo get_option('email'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Số điện thoại</th>
        <td><input type="text" name="phonenumber" value="<?php echo get_option('phonenumber'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Fax</th>
        <td><input type="text" name="fax" value="<?php echo get_option('fax'); ?>" /></td>
        </tr>    
        
        <tr><td colspan="2"><h3>Tùy chỉnh Trang Chủ - TopContent</h3><td></tr>
        
        <tr valign="top">
        <th scope="row">Category thứ 1:</th>
        <td><input type="text" name="top_first_category" value="<?php echo get_option('top_first_category'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Category thứ 2:</th>
        <td><input type="text" name="top_second_category" value="<?php echo get_option('top_second_category'); ?>" /></td>
        </tr> 
        
        <tr valign="top">
        <th scope="row">Category thứ 3:</th>
        <td><input type="text" name="top_third_category" value="<?php echo get_option('top_third_category'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Category thứ 4:</th>
        <td><input type="text" name="top_fourth_category" value="<?php echo get_option('top_fourth_category'); ?>" /></td>
        </tr> 
        
        <tr><td colspan="2"><h3>Tùy chỉnh Trang Chủ - BotContent</h3><td></tr>
        
        <tr valign="top">
        <th scope="row">Category thứ 1:</th>
        <td><input type="text" name="first_category" value="<?php echo get_option('first_category'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Category thứ 2:</th>
        <td><input type="text" name="second_category" value="<?php echo get_option('second_category'); ?>" /></td>
        </tr>   
        
        <tr><td colspan="2"><h3>Tùy chỉnh Trang Tin Tức - Category Menu</h3><td></tr>
        
        <tr valign="top">
        <th scope="row">Category cha:</th>
        <td><input type="text" name="news_godfather_category" value="<?php echo get_option('news_godfather_category'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Category thứ 1:</th>
        <td><input type="text" name="news_first_category" value="<?php echo get_option('news_first_category'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Category thứ 2:</th>
        <td><input type="text" name="news_second_category" value="<?php echo get_option('news_second_category'); ?>" /></td>
        </tr> 
        
        <tr valign="top">
        <th scope="row">Category thứ 3:</th>
        <td><input type="text" name="news_third_category" value="<?php echo get_option('news_third_category'); ?>" /></td>
        </tr>
        
        <tr valign="top">
        <th scope="row">Category thứ 4:</th>
        <td><input type="text" name="news_fourth_category" value="<?php echo get_option('news_fourth_category'); ?>" /></td>
        </tr> 

        
    </table>
    
    <?php submit_button(); ?>

</form>
</div>
<?php } ?>


